package com.xwd.web.menu;

import com.xwd.domain.Menu;
import com.xwd.service.MenuService;
import com.xwd.service.impl.MenuServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/power/menu/menus")
public class MenuServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getParameter("method");
        if("mList".equals(method)){
            this.mList(req,resp);
        }
    }

    protected void mList(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        MenuService menuService = new MenuServiceImpl();
        List<Menu> menuList = menuService.getMenuList();
        req.setAttribute("mList",menuList);
        req.getRequestDispatcher("/power/role/add.jsp").forward(req,resp);

    }
}
